<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*  立即执行函数:防止变量污染
     无需调用，立即执行，其本质已经调用了，多个立即执行函数之间用分号隔开 */

    // 俩种写法
    //1.(function () {})(); 2.(function () {}());

    (function () {
      console.log(11)
    })();

    (function () {
      let num = 10
    })();
    (function () {
      let num = 20
    })();

    (function sum(x, y) {
      console.log(x + y)
    })(1, 2);

  </script>
</body>

</html>